<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<link rel="Shortcut Icon" href="/images/favicon.ico" type="image/x-icon" />
<title></title>
<link rel="stylesheet" href="asciidoc-6.css" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/asciidoc.css" type="text/css" />
<link rel="stylesheet" href="website-6.css" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/website.css" type="text/css" />
</head>

<body>

<div id="layout-menu-box">
<div id="layout-menu">
  <div><a href="WhatIsPeach.html" tppabs="http://old.peachfuzzer.com/WhatIsPeach.html">What is Peach</a></div>
  <div><a href="Installation.html" tppabs="http://old.peachfuzzer.com/v3/Installation.html"><b>Installing</b></a></div>
  <div><a href="PeachQuickStart.html" tppabs="http://old.peachfuzzer.com/v3/PeachQuickStart.html"><b>Tutorials</b></a></div>
  <div><a href="Methodology.html" tppabs="http://old.peachfuzzer.com/Methodology.html">Methodology</a></div>
  <div><a href="Introduction.html" tppabs="http://old.peachfuzzer.com/Introduction.html">Introduction</a></div>
  <div><a href="Training.html" tppabs="http://old.peachfuzzer.com/Training.html">Training</a></div>
  <div><a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html">Enterprise</a></div>
  <div><a href="FAQ.html" tppabs="http://old.peachfuzzer.com/v3/FAQ.html">FAQ</a></div>
  <div><a href="javascript:if(confirm(%27http://forums.peachfuzzer.com/forum.php  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://forums.peachfuzzer.com/forum.php%27" tppabs="http://forums.peachfuzzer.com/forum.php">Support Forums</a></div>

  <div><h5>Peach 3</h5></div>
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="PeachPit.html" tppabs="http://old.peachfuzzer.com/v3/PeachPit.html">Peach Pits</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="GeneralConfiguration.html" tppabs="http://old.peachfuzzer.com/v3/GeneralConfiguration.html">General Conf</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="DataModeling.html" tppabs="http://old.peachfuzzer.com/v3/DataModeling.html">Data Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="StateModel.html" tppabs="http://old.peachfuzzer.com/v3/StateModel.html">State Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Agents</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Monitors</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="TestConfig.html" tppabs="http://old.peachfuzzer.com/v3/TestConfig.html">Test</a></div>
        <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Publisher.html" tppabs="http://old.peachfuzzer.com/v3/Publisher.html">Publishers</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Logger.html" tppabs="http://old.peachfuzzer.com/v3/Logger.html">Loggers</a></div>
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/DebuggingPitFiles.html">Debugging Pits</a></div> -->
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/ValidatingPitFiles.html">Validating Pits</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="RunningPeach.html" tppabs="http://old.peachfuzzer.com/v3/RunningPeach.html">Running</a></div>
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ParallelPeach.html">Parallel</a></div> -->
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ExtendingPeach.html">Extending</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="minset.html" tppabs="http://old.peachfuzzer.com/v3/minset.html">Minset</a></div>

  <div><h5><a href="peach23.html" tppabs="http://old.peachfuzzer.com/v2/peach23.html">Peach 2.3</a></h5></div>

  <div><hr/></div>

  <div><a href="License.html" tppabs="http://old.peachfuzzer.com/License.html">License</a></div>
</div>
</div>
<div id="layout-content-box">
<div id="layout-banner">
  <div id="layout-title">
    <a href="index.htm" tppabs="http://old.peachfuzzer.com/"><img src="peach_fuzzer.png" tppabs="http://old.peachfuzzer.com/images/peach_fuzzer.png" height="100" /></a>
    <a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html" class="layout-inner-banner-right">
                <img height="50" src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" /></a>
  </div>

  <div id="layout-description">
  <script>
  (function() {
    var cx = '007028538774543840348:g-0dlrdlmxs';
    var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
      </div>
</div>
<div id="layout-content">
<div id="content">
<div class="paragraph"><p><a href="DevelopmentEnvironment-1.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/DevelopmentEnvironment.html">&lt;&lt; Previouse</a> | <a href="TutorialFileFuzzing.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing.html">Up</a> | <a href="CreateStateModel-1.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/CreateStateModel.html">Next &gt;&gt;</a></p></div>
<hr />
<div class="sect1">
<h2 id="_creating_wave_data_models">Creating Wave Data Models</h2>
<div class="sectionbody">
<div class="paragraph"><p>Now we are going to dive right in.
Lets start by making a copy of <code>template.xml</code> (found in your Peach folder) to <code>wav.xml</code>.
This will hold all of the information about our WAV fuzzer.
You will also want a sample WAV file, grab <a href="javascript:if(confirm(%27http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/WAVE/Samples/AFsp/M1F1-int32WE-AFsp.wav  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/WAVE/Samples/AFsp/M1F1-int32WE-AFsp.wav%27" tppabs="http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/WAVE/Samples/AFsp/M1F1-int32WE-AFsp.wav">this one</a>.</p></div>
<div class="paragraph"><p>Go ahead and load up <code>wav.xml</code> into your XML editor.</p></div>
<div class="paragraph"><p>Now, you will want to check out the following two specifications to get an idea for the format of WAV:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
<a href="javascript:if(confirm(%27http://www.sonicspot.com/guide/wavefiles.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.sonicspot.com/guide/wavefiles.html%27" tppabs="http://www.sonicspot.com/guide/wavefiles.html">Wave File Format</a>
</p>
</li>
<li>
<p>
RIFF File Specification (Microsoft)
</p>
</li>
</ol></div>
<div class="paragraph"><p>If you glance through the wave file format you will notice that the wave file is composed of a file header followed by a number of chunks.
This is fairly common for file formats and also network packets.
Typically each chunk has the same format that follows some form of T-L-V or Type-Length-Value, in fact wave file chunks are just that, a type followed by length followed by data.
Each chunk type will define what there data looks like.</p></div>
<div class="paragraph"><p>Based on this basic information we can plan out our fuzzer.
We will have several top level "<a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>" elements that will be called:</p></div>
<div class="ulist"><ul>
<li>
<p>
Chunk
</p>
</li>
<li>
<p>
ChunkFmt
</p>
</li>
<li>
<p>
ChunkData
</p>
</li>
<li>
<p>
ChunkFact
</p>
</li>
<li>
<p>
ChunkCue
</p>
</li>
<li>
<p>
ChunkPlst
</p>
</li>
<li>
<p>
ChunkList
</p>
</li>
<li>
<p>
ChunkLabl
</p>
</li>
<li>
<p>
ChunkLtxt
</p>
</li>
<li>
<p>
ChunkNote
</p>
</li>
<li>
<p>
ChunkSmpl
</p>
</li>
<li>
<p>
ChunkInst
</p>
</li>
<li>
<p>
Wav
</p>
</li>
</ul></div>
<div class="paragraph"><p>The <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a> called <em>Chunk</em> will be a template for each of the following types of
chunks and we will pull all of it together, and also define our header in the last
<a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a> called <em>Wav</em>.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_setting_defaults_for_number_element">Setting Defaults for Number element</h2>
<div class="sectionbody">
<div class="paragraph"><p>The majority of numbers used in WAV are unsigned.
We can make that the default by adding this XML to our PIT:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Defaults&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Defaults&gt;</span></span></tt></pre></div></div>
</div>
</div>
<div class="sect1">
<h2 id="_creating_the_wav_datamodel">Creating the Wav DataModel</h2>
<div class="sectionbody">
<div class="paragraph"><p>Okay, head over to your <code>wav.xml</code> file and lets start writing some XML!
Locate the <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a> called <em>TheDataModel</em> is should look something like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- TODO: Create data model --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheDataModel"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a></p></div>
<div class="paragraph"><p>We are going to rename this <em>Wav</em> and define the header for our wave file.
Looking at the specification I notice that the format for the wave header is:</p></div>
<div class="ulist"><ul>
<li>
<p>
File magic: 4 character string, always "RIFF"
</p>
</li>
<li>
<p>
Length of file: 32 bit unsigned integer
</p>
</li>
<li>
<p>
Riff type: 4 character string, always "WAVE"
</p>
</li>
</ul></div>
<div class="paragraph"><p>We can define that in Peach using the following XML:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the format of a WAV file --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Wav"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-style: italic"><span style="color: #9A1900">&lt;!-- wave header --&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"RIFF"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"WAVE"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a></p></div>
<div class="paragraph"><p>Otherwise we will continue on and define the <em>Chunk</em> DataModel.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_chunk_datamodel">Chunk DataModel</h2>
<div class="sectionbody">
<div class="paragraph"><p>The <em>Chunk</em> data model should be the first data model in the Peach Pit file,
so lets add it in above the <em>Wav</em> data model as follows:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the common wave chunk --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span>

<span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the format of a WAV file --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Wav"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-style: italic"><span style="color: #9A1900">&lt;!-- wave header --&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"RIFF"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"WAVE"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a></p></div>
<div class="paragraph"><p>Notice that the <em>Chunk</em> data model occurs before the <em>Wav</em> data model.
This is important, we will later reference this data model and it must be defined before we use it.</p></div>
<div class="paragraph"><p>Looking at the specification we know that the wave chunk format is as follows:</p></div>
<div class="ulist"><ul>
<li>
<p>
ID: 4 character string padded with spaces
</p>
</li>
<li>
<p>
Size: 4 byte unsigned integer
</p>
</li>
<li>
<p>
Data: bytes of data the size of Size
</p>
</li>
</ul></div>
<div class="paragraph"><p>We can model that in Peach using the following XML:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the common wave chunk --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Size"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"size"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Blob</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Padding</span></span> <span style="color: #009900">alignment</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="Relation.html" tppabs="http://old.peachfuzzer.com/v3/Relation.html">Relation</a>, <a href="Blob.html" tppabs="http://old.peachfuzzer.com/v3/Blob.html">Blob</a>, <a href="Padding.html" tppabs="http://old.peachfuzzer.com/v3/Padding.html">Padding</a></p></div>
<div class="paragraph"><p>Notice that we have created a size <a href="Relation.html" tppabs="http://old.peachfuzzer.com/v3/Relation.html">relationship</a> between <em>Size</em> and <em>Data</em>.
By doing this <em>Size</em> will automatically get updated with the size of <em>Data</em> when we produce data.
When we parse in a sample file to use as default values this will instruct the parser that it can
find the size of <em>Data</em> by looking at <em>Size</em>.</p></div>
<div class="paragraph"><p>Now we can use a Padding type to pad out our DataModel correctly.
Notice that the alignment attribute is set to 16.
This tells the <a href="Padding.html" tppabs="http://old.peachfuzzer.com/v3/Padding.html">Padding</a> element to automatically size itself so that the <em>Chunk</em> DataModel ends
on a 16-bit (2-byte) boundary.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_format_chunk">Format Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Now we are going to define the details of the format chunk.
We will use the generic chunk we already defined as a template for this chunk.
That will allow us to only specify the specifics of this chunk and save on some typing.</p></div>
<div class="paragraph"><p>Looking at the wave specification we can tell that the format chunk is as follows:</p></div>
<div class="ulist"><ul>
<li>
<p>
ID: Always 'fmt '
</p>
</li>
<li>
<p>
Data:
</p>
<div class="ulist"><ul>
<li>
<p>
Compression code: 16 bit unsigned int
</p>
</li>
<li>
<p>
Number of channels: 16 bit unsigned int
</p>
</li>
<li>
<p>
Sample rate: 32bit unsigned int
</p>
</li>
<li>
<p>
Average bytes per second: 32bit unsigned int
</p>
</li>
<li>
<p>
Block align: 16 bit unsigned int
</p>
</li>
<li>
<p>
Significant bits per sample: 16 bit unsigned int
</p>
</li>
<li>
<p>
Extra format bytes: 16 bit unsigned int
</p>
</li>
</ul></div>
</li>
</ul></div>
<div class="paragraph"><p>The <em>ChunkFmt</em> data model will be defined after <em>Chunk</em> but before <em>Wav</em>:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkFmt"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"fmt "</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"CompressionCode"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"NumberOfChannels"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"SampleRate"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"AverageBytesPerSecond"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"BlockAlign"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"SignificantBitsPerSample"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ExtraFormatBytes"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Blob</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ExtraData"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="Blob.html" tppabs="http://old.peachfuzzer.com/v3/Blob.html">Blob</a></p></div>
<div class="paragraph"><p>Now, if you look at this you will notice a number of cool things.
First off if you check out the DataModel element you can see an attribute called <em>ref</em> which has a value of <em>Chunk</em>.
This tells Peach to copy the <em>Chunk</em> data model and make it the basis for our new data model called <em>ChunkFmt</em>.
This means that all the elements defined in <em>Chunk</em> are in our new <em>ChunkFmt</em> by default!
This is way cool and our first look at re-use in Peach.
Next you will notice we have two elements in our data model that have the same name as elements in the <em>Chunk</em> model (ID and Data).
This will cause the old elements to be replaced with our new ones.
This allows us to override the old elements based on the needs of our format chunk type.</p></div>
<div class="paragraph"><p>Now, you might be asking why we needed to override ID?
This is a good question, we override ID here to specify the static string that it will always be when for this format chunk.
Later we will specify a sample wave file to use and the parser will need hints on how to select the correct chunk.
More on that later when we introduce the <a href="javascript:if(confirm(%27http://old.peachfuzzer.com/v3/TutorialFileFuzzing/v3/Choice.html  \n\nThis file was not retrieved by Teleport Ultra, because the server reports that access to this file is forbidden.  \n\nDo you want to open it from the server?%27))window.location=%27http://old.peachfuzzer.com/v3/TutorialFileFuzzing/v3/Choice.html%27" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/v3/Choice.html">Choice</a> element :)</p></div>
<div class="paragraph"><p>Otherwise I think things should largely make sense.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_data_chunk">Data Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Next up is the data chunk.  This one is easy as the <em>Data</em> portion of the packet has no structure.  We can define this chunk as follows:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkData"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"data"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>Easy!</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_fact_chunk">Fact Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Okay, now we have the fact chunk.  This chunk is defined as follows:</p></div>
<div class="ulist"><ul>
<li>
<p>
ID: "fact", string 4 chars
</p>
</li>
<li>
<p>
Data:
</p>
<div class="ulist"><ul>
<li>
<p>
Number of samples: 32 bit unsigned int
</p>
</li>
<li>
<p>
Unknown? Unknown trailing bytes
</p>
</li>
</ul></div>
</li>
</ul></div>
<div class="paragraph"><p>Another easy one to define in XML:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkFact"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"fact"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Blob/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="Blob.html" tppabs="http://old.peachfuzzer.com/v3/Blob.html">Blob</a></p></div>
<div class="paragraph"><p>Notice that I was lazy and decided not to name the <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a> or <a href="Blob.html" tppabs="http://old.peachfuzzer.com/v3/Blob.html">Blob</a> here.
Peach does not require that all elements have names, only ones that are being referenced.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_wave_list_chunk">Wave List Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>This chunk it a bit different.
The wave list chunk is comprised of silent chunk and data chunks alternating in a list.
So, before we can complete the wave list chunk we will need to define the silent chunk.
Lets do that now.</p></div>
<div class="paragraph"><p>The silent chunk of easy, it&#8217;s just a 4 byte unsigned integer, the data model looks like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkSint"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"sInt"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a></p></div>
<div class="paragraph"><p>Now that that&#8217;s out of the way we can get on with our wave list chunk.
The data portion is an array of silent and data chunks.
Here is how we do that:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkWavl"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"wavl"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ArrayOfChunks"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"3000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkSint"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkData"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>This definition introduces the concept of arrays, or repeating elements.
Notice that we have a <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">block</a> element that has an attribute <em>maxOccurs</em>.
This will tell Peach that this block may occur more then one, upto 3,000 times.
Also you will notice we are using the <em>ref</em> attribute with the <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a> element.
This is just like using it with the data model, but allows us to get re-use inside of the data model as well.</p></div>
<div class="paragraph"><p>That wasn&#8217;t so hard!</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_cue_chunk">Cue Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Now onto the cue chunk.
This chunk should be easy now that we know about the <em>maxOccurs</em> attribute.
This chunk is also an array.
The array is comprised of the following:</p></div>
<div class="ulist"><ul>
<li>
<p>
ID: 4 bytes
</p>
</li>
<li>
<p>
Position: 4 byte unsigned integer
</p>
</li>
<li>
<p>
Data Chunk ID: 4 byte RIFF ID
</p>
</li>
<li>
<p>
Chunk start: 4 byte unsigned integer offset of data chunk
</p>
</li>
<li>
<p>
Block start: 4 byte unsigned integer offset to sample of first channel
</p>
</li>
<li>
<p>
Sample offset: 4 byte unsigned integer offset to sample byte of first channel
</p>
</li>
</ul></div>
<div class="paragraph"><p>We don&#8217;t have to worry about the fact the last 3 numbers are offset&#8217;s.  The data is already parsed in the wave list chunk, we just need to read them in.  So lets build the XML!</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkCue"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"cue "</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ArrayOfCues"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"3000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a></p></div>
<div class="paragraph"><p>There shouldn&#8217;t be any surprises here, we are just re-using the same stuff as before.
Once again I&#8217;m being a bit lazy and not giving everything a name.
This is okay, but it can be nice sometimes to use the names as documentation :)</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_playlist_chunk">Playlist Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Looking at this chunk I notice that <em>Data</em> will be comprised of an array (again) but this time the count will be included before the array.
We will use a count-of relationship to model this.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkPlst"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"plst"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"NumberOfSegments"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"count"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"ArrayOfSegments"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ArrayOfSegments"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"3000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Relation.html" tppabs="http://old.peachfuzzer.com/v3/Relation.html">Relation</a></p></div>
<div class="paragraph"><p>Notice in this XML that we setup a relationship between <em>NumberOfSegments</em> and <em>ArrayOfSegments</em> that will indicate the count.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_associated_data_list_chunk">Associated Data List Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>This chunk is an array of label chunks, name chunks, and text chunks.
We will not know in what order they will appear so we will need to support them in any order.
This will actually be fairly easy, but first we need to define each of the tree chunks before we define our data list chunk.
Lets do that now.</p></div>
<div class="sect2">
<h3 id="_label_chunk">Label Chunk</h3>
<div class="paragraph"><p>First up is the label chunk, in this the data portion contains a null terminated string an possible a single pad byte.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLabl"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"labl"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>We will automatically get the pad byte from the <em>Chunk</em>.</p></div>
</div>
<div class="sect2">
<h3 id="_note_chunk">Note Chunk</h3>
<div class="paragraph"><p>Now onto the note chunk, it turns out this chunk is exactly the same as the label chunk!
So, we will just create an alias for it like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkNote"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLabl"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"note"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>Yup, that&#8217;s it!  Nice and easy :)</p></div>
</div>
<div class="sect2">
<h3 id="_labeled_text_chunk">Labeled Text Chunk</h3>
<div class="paragraph"><p>This one is also very similar to the note and label chunks but has several more numbers included in it.
I&#8217;ll copy the data model for label and expand it like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLtxt"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"ltxt"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"16"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>As we can see it&#8217;s very similar to the label chunk.</p></div>
</div>
<div class="sect2">
<h3 id="_back_to_associated_data_list_chunk">Back to Associated Data List Chunk</h3>
<div class="paragraph"><p>Okay, we are ready to combine all those chunks into an array.
It will end up looking like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkList"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"list"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"adtl"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Choice</span></span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"3000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLabl"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkNote"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLtxt"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Choice&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Choice.html" tppabs="http://old.peachfuzzer.com/v3/Choice.html">Choice</a></p></div>
<div class="paragraph"><p>Here we are introducing the <a href="Choice.html" tppabs="http://old.peachfuzzer.com/v3/Choice.html">Choice</a> element.
This element will try each of the <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>s we specify looking for the best match.
You will notice at the end of the list is <em>Chunk</em>.
This is our catch-all.
The specification indicates there could be other types of blocks that will show up here.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_sampler_chunk">Sampler Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>The sampler chunk is similar to what we have already seem, it contains several numbers and then an array of some values.
We will define it as follows:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkSmpl"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"smpl"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"3000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
            <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>Again, that was straight forward :)</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_instrument_chunk">Instrument Chunk</h2>
<div class="sectionbody">
<div class="paragraph"><p>Few, this is our last chunk to define and it&#8217;s an easy one.
It&#8217;s comprised of just seven (7) 8 bit numbers.  This will be super easy.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkInst"</span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ID"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"inst"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>Notice that the numbers in this case are not unsigned.
The values they can have range from negative to positive.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_finishing_the_wav_model">Finishing the Wav Model</h2>
<div class="sectionbody">
<div class="paragraph"><p>Time to wrap this modeling up!
Lets head down to the <em>Wav</em> chunk which last we touched it looked like this:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the format of a WAV file --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Wav"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-style: italic"><span style="color: #9A1900">&lt;!-- wave header --&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"RIFF"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"WAVE"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a></p></div>
<div class="paragraph"><p>We are going to add in an array of chunks, however we don&#8217;t know in what order all these chunks will occur in,
so we will use our friend the <a href="Choice.html" tppabs="http://old.peachfuzzer.com/v3/Choice.html">Choice</a> element to have Peach choose for us based on the input file.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Defines the format of a WAV file --&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Wav"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-style: italic"><span style="color: #9A1900">&lt;!-- wave header --&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"RIFF"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"WAVE"</span> <span style="color: #009900">token</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>

    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Choice</span></span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"30000"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkFmt"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkData"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkFact"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkSint"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkWavl"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkCue"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkPlst"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkLtxt"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkSmpl"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"ChunkInst"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">ref</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunk"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Choice&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p>Read more about: <a href="DataModel.html" tppabs="http://old.peachfuzzer.com/v3/DataModel.html">DataModel</a>, <a href="Block.html" tppabs="http://old.peachfuzzer.com/v3/Block.html">Block</a>, <a href="Number.html" tppabs="http://old.peachfuzzer.com/v3/Number.html">Number</a>, <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a>, <a href="Choice.html" tppabs="http://old.peachfuzzer.com/v3/Choice.html">Choice</a></p></div>
<div class="paragraph"><p>That wasn&#8217;t so hard was it!</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_next_steps">Next Steps</h2>
<div class="sectionbody">
<div class="paragraph"><p>All the hard work is over, but there is still stuff we need to do before we can run our fuzzer!</p></div>
<hr />
<div class="paragraph"><p><a href="DevelopmentEnvironment-1.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/DevelopmentEnvironment.html">&lt;&lt; Previouse</a> | <a href="TutorialFileFuzzing.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing.html">Up</a> | <a href="CreateStateModel-1.html" tppabs="http://old.peachfuzzer.com/v3/TutorialFileFuzzing/CreateStateModel.html">Next &gt;&gt;</a></p></div>
</div>
</div>
</div>
<div id="footnotes"></div>
<div id="footer">
<div id="footer-text">

<table width="100%">
<td><td>
<a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/"><img src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" height="50"/></a>
</td><td>&nbsp;&nbsp;&nbsp;</td><td>

Copyright (c) <a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/">Deja vu Security</a> <br/>
Last updated 2014-02-23 21:23:35 PST
</td>
</table>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1094513-10']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www/') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</div>
</div>
</div>
</div>
</body>
</html>
